home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Storm
/
Scene Storm - Volume 1.iso
/
coding
/
asm
/
utils
/
noclick
/
noclick.s
Wrap
Text File
|
1980-01-03
|
2KB
|
63 lines
AbsExecBase=$4
_LVOCreateIORequest=-$28E
_LVODeleteIORequest=-$294
_LVODeleteMsgPort=-$2A0
_LVOCreateMsgPort=-$29A
_LVOOpenDevice=-$1BC
_LVOCloseDevice=-$1C2
TDP_NOCLICK=$35
*******************************************************************************
* NoClick
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* This small snippet of assembly source-code allows you to turns off/on
* the disk-drive clicking. Note: This one only works on OS2.0 and above!
*
* The first time its run the drive clicking is stopped. The second time it
* is re-enabled.
*******************************************************************************
_AllPatch moveq #0,d0 ;df0
bsr.s _PatchDrives
moveq #1,d0 ;df1
bsr.s _PatchDrives
moveq #2,d0 ;df2
bsr.s _PatchDrives
moveq #3,d0 ;df3
_PatchDrives: move.l d0,d7 ;save drive to patch for later
move.l (AbsExecBase).w,a6 ;get execbase
jsr _LVOCreateMsgPort(a6) ;Generate a message port
move.l d0,a5 ;save msg port ptr
beq.s PortFail ;exit if failed!
move.l a5,a0 ;ptr to our msg port
moveq #48,d0
jsr _LVOCreateIORequest(a6) ;Do an IO request
move.l d0,a3 ;save request ptr
beq.s IOFail ;exit if failed!
lea TDName.txt(pc),a0 ;ptr to 'trackdisk' name
move.l d7,d0 ;drive.. dfx
move.l a3,a1 ;IO Request
moveq #0,d1
jsr _LVOOpenDevice(a6) ;Open the trackdisk device
tst.b d0 ;did it fail?
bne.s TDFail ;if >0 failed to open!
move.l $18(a3),a0 ;get ptr to public flags
bchg d0,TDP_NOCLICK(a0) ;fix critical bit (BIT 0!)
;use BCLR 2 turn click back on!
CloseTD: move.l a3,a1
jsr _LVOCloseDevice(a6) ;close trackdisk device
TDFail: move.l a3,a0
jsr _LVODeleteIORequest(a6) ;kill the IO request
IOFail: move.l a5,a0
jsr _LVODeleteMsgPort(a6) ;delete the message port
PortFail: moveq #0,d0 ;no cli error code
rts
TDName.txt: dc.b 'trackdisk.device',0
even